<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>axios基础使用</title>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<h1>axios基础使用</h1>

  <button id="btn">点击查询数据</button>


<script>

  const btn = document.querySelector('#btn')

  btn.onclick =async function () {
  //  引用axios
    const re = await axios({
      url:'/user',
      data:{},
      method:'get',
      headers:{},
      timeout:10000,
      params:{
        userId:'001'
      }
    })
    console.log('re',re.data.data)
  }

</script>
</body>
</html>